package com.xf;

import com.xf.bean.ConsumerComponent;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import java.util.concurrent.*;

/**
 * @ClassName ConsumerMain
 * @Deseription TODO
 * @Author fx
 * @Date 2021/4/27 0027 21:53
 * @Version 1.0
 **/
public class ConsumerMain {
    public static void main(String[] args) throws Exception {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ConsumerConfiguration.class);
        context.start();
        ConsumerComponent component = context.getBean(ConsumerComponent.class);
        long startTime = System.currentTimeMillis();
        while (true){
            TimeUnit.MILLISECONDS.sleep(20);
            component.sayHello("world",startTime);
        }
    }

    @Configuration
    @PropertySource("classpath:/dubbo-consumer.properties")
    @ComponentScan("com.xf.bean")
    @EnableDubbo
    static class ConsumerConfiguration {

    }
}
